package mil.af.amc.adpetracker.mail;

import org.springframework.mail.MailSender;
import org.springframework.mail.SimpleMailMessage;
import mil.af.amc.adpetracker.model.User;

/**
 * Please Fill in this Javadoc
 *
 * @author TSgt Jason Ferguson
 */

public abstract class AbstractMailSender {

    protected abstract MailSender getMailSender();

    public final void sendMessage(User to, String subject, String text) {

        SimpleMailMessage msg = new SimpleMailMessage();
        msg.setTo(to.getEmail());
        msg.setFrom("ADPETRACK-NOREPLY@scott.af.mil");
        msg.setSubject(subject);
        msg.setText(text);

        MailSender sender = getMailSender();
        sender.send(msg);
    }
}
